package com.jjyu.service.impl;

import com.jjyu.dao.RestaurantMapper;
import com.jjyu.entity.Restaurant;
import com.jjyu.service.RestaurantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RestaurantServiceImpl implements RestaurantService {
    @Autowired
    private RestaurantMapper restaurantMapper;

    @Override
    public void save(Restaurant restaurant) {
        restaurantMapper.insert(restaurant);
    }

    @Override
    public List<Restaurant> getAllRestaurant() {
        return restaurantMapper.selectList(null);
    }

    @Override
    public List<Restaurant> getRestaurantByAddStr(String location) {
        return restaurantMapper.getRestaurantByAddStr(location);
    }

    @Override
    public Restaurant getById(Integer id) {
        return restaurantMapper.selectById(id);
    }
}